<?php $this->load->view('header'); ?>
<?php $this->load->view('cuerpo'); ?>

<div class="formulario">
	<center><input type="button" onclick="location.href='<?php echo base_url();?>index.php/orden/reporte'" value="Regresar"></center><br/>
	<form>
		<table>
			<tr>
				<td><label>Monto Total</label></td>
				<?php if ($igv == 1){
					$tot = $monto1;
				}else {
					$tot = $monto2;
				}?>
				<td><input type="text" name="txtMonto" value="<?= $tot ?>" disabled /></td>
			</tr>
			<tr>
				<td><label>Incluye IGV</label></td>
				<?php if ($igv == 1){
					$igv_tot = STR_SI;
				}else {
					$igv_tot = STR_NO;
				}?>
				<td><input type="text" name="txtIgv" value="<?= $igv_tot ?>" disabled /></td>
			</tr>
			<tr>
				<td><label>Fecha OC Generada</label></td>
				<td><input type="text" name="dFecha" value="<?php echo $fecha_generada; ?>" disabled/></td>
			</tr>
		</table>
	</form>
</div>
<section id="dt_example">
	<div id="container">
		<table border="1" class="display" id="detalle_oc">
			<thead>
				<tr>
					<th># ITEM</th>
					<th>REPUESTO</th>
					<th>PROVEEDOR</th>
					<th>O/A</th>
					<th>CANTIDAD</th>
					<th>PRECIO</th>
					<th>P*C</th>
				</tr>
			</thead>
			<tbody>
				<?php
				$precio= "";
				$n="";
				foreach ($detalle as $oc){ 
					$cantidad = $oc->cantidad;
					$total = $oc->total;
					$precio = $total/$cantidad;
					$n += 1;
				?>				
				<tr>
					<td><?php echo $n?></td>
					<td><?php echo $oc->repuesto ?></td>
					<td><?php echo $oc->razon ?></td>
					<td><?php echo $oc->tipo ?></td>
					<td><?php echo $oc->cantidad ?></td>
					<td><?php echo $precio ?></td>
					<td><?php echo $oc->total ?></td>		
				</tr>
				 <?php }; ?>
			</tbody>
		</table>
	</div>
</section>
<br>

<?php $this->load->view('footer'); ?>